#ifndef _SYSTEM_H
#define _SYSTEM_H

class kSystem {
	public:
		//kSystem(name, type, numberPlanets, numberLinks,x,y)
		kSystem(char*,int,int,int,int,int);
		~kSystem();
		
		//generic getters
		inline const char *name();
		inline const int numberPlanets();
		inline const int numberLinks();
		inline const kPlanet *planet(int);
		const kPlanet *planet(char*);
		inline const kLink *link(int);
		const kLink *link(kSystem*);
		const kLink *link(char*);
		
		inline const int x();
		inline const int y();
		
		//whether or not the given fleet can enter 
		//the system (return one of the bottom)
		int moveFleetToSystem(kFleet*);
		
		static const int ENTER = 1;
		static const int NOENTER = 2;
		static const int HIDDEN = 3;
		
		void addPlanet(kPlanet*);
		//This should have all the values the planet would normally have, so as
		//not to call the constructor in addPlanet(kPlanet)
		//void addPlanet(char*,int,int);
		bool addLink(kLink*);
		
		//determine system wide morale levels - based on planets & fleet
		//for the specified player
		//also look at surrounding status and previous scores
		int systemMoraleLevels(kPLayer*);
		
		//whether or not player has sufficient technology/placements to detect hidden
		//fleet if there is one (returns false is if planet contested)
		bool detectHiddenFleet(kFleet*);
		//whether or not the system is fully controlled by one player or another
		bool planetControlled();
		
		char **linkTargets();
		//all links with length less than the given range
		list<kLink*> *linksInRange(double);
		
		kPlayer *dominantPlayer();
		
		//whether or not the system detects the specified fleet
		bool detectFleet(kFleet*);
		
		//process PlanetOrders for planets in the system
		void processSystem();
		
		inline static char *starTypeName(kSystem*);
		static kGame *game; //Game this is currently taking place in
	private:
		char *sname; //name of system
		int snumberplanets; //number of planets in system
		kPlanet **splanets; //array of planets in system
		int snumberlinks; //number of links in system
		kLink **slinks; //links connecting this system to other systems
		int sstartype; //type of star in system
		
		int sdefenders;
		int sattackers;
		int shidden;
		
		kFleet *sdefendingfleet; //fleet assigned to defending the system
		kFleet *sattackingfleet; //fleet assigned to attacking the system
		kFleet *shiddenfleet; //fleet that is unknown but present in system
		
		int sx;
		int sy;
};

#endif